home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH1 / SRC / MIRROR.FRM < prev    next >
Text File  |  1996-05-02  |  6KB  |  221 lines

  1. VERSION 4.00
  2. Begin VB.Form MirrorForm 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Mirror"
  5.    ClientHeight    =   5205
  6.    ClientLeft      =   3705
  7.    ClientTop       =   735
  8.    ClientWidth     =   2115
  9.    Height          =   5895
  10.    Left            =   3645
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5205
  13.    ScaleWidth      =   2115
  14.    Top             =   105
  15.    Width           =   2235
  16.    Begin VB.PictureBox PSetDest 
  17.       AutoRedraw      =   -1  'True
  18.       AutoSize        =   -1  'True
  19.       Height          =   1020
  20.       Left            =   1080
  21.       ScaleHeight     =   64
  22.       ScaleMode       =   3  'Pixel
  23.       ScaleWidth      =   64
  24.       TabIndex        =   11
  25.       Top             =   240
  26.       Width           =   1020
  27.    End
  28.    Begin VB.PictureBox PaintDest 
  29.       AutoRedraw      =   -1  'True
  30.       AutoSize        =   -1  'True
  31.       Height          =   1020
  32.       Left            =   1080
  33.       ScaleHeight     =   64
  34.       ScaleMode       =   3  'Pixel
  35.       ScaleWidth      =   64
  36.       TabIndex        =   10
  37.       Top             =   3840
  38.       Width           =   1020
  39.    End
  40.    Begin VB.PictureBox RefreshDest 
  41.       AutoRedraw      =   -1  'True
  42.       AutoSize        =   -1  'True
  43.       Height          =   1020
  44.       Left            =   1080
  45.       ScaleHeight     =   64
  46.       ScaleMode       =   3  'Pixel
  47.       ScaleWidth      =   64
  48.       TabIndex        =   9
  49.       Top             =   2040
  50.       Width           =   1020
  51.    End
  52.    Begin VB.PictureBox RefreshSource 
  53.       AutoRedraw      =   -1  'True
  54.       AutoSize        =   -1  'True
  55.       Height          =   1020
  56.       Left            =   0
  57.       Picture         =   "MIRROR.frx":0000
  58.       ScaleHeight     =   64
  59.       ScaleMode       =   3  'Pixel
  60.       ScaleWidth      =   64
  61.       TabIndex        =   6
  62.       Top             =   2040
  63.       Width           =   1020
  64.    End
  65.    Begin VB.PictureBox PaintSource 
  66.       AutoRedraw      =   -1  'True
  67.       AutoSize        =   -1  'True
  68.       Height          =   1020
  69.       Left            =   0
  70.       Picture         =   "MIRROR.frx":0882
  71.       ScaleHeight     =   64
  72.       ScaleMode       =   3  'Pixel
  73.       ScaleWidth      =   64
  74.       TabIndex        =   1
  75.       Top             =   3840
  76.       Width           =   1020
  77.    End
  78.    Begin VB.PictureBox PSetSource 
  79.       AutoRedraw      =   -1  'True
  80.       AutoSize        =   -1  'True
  81.       Height          =   1020
  82.       Left            =   0
  83.       Picture         =   "MIRROR.frx":1104
  84.       ScaleHeight     =   64
  85.       ScaleMode       =   3  'Pixel
  86.       ScaleWidth      =   64
  87.       TabIndex        =   0
  88.       Top             =   240
  89.       Width           =   1020
  90.    End
  91.    Begin VB.Label Label1 
  92.       Alignment       =   2  'Center
  93.       Caption         =   "Point/PSet W/refresh"
  94.       Height          =   255
  95.       Index           =   2
  96.       Left            =   0
  97.       TabIndex        =   8
  98.       Top             =   1800
  99.       Width           =   2100
  100.    End
  101.    Begin VB.Label RefreshLabel 
  102.       BorderStyle     =   1  'Fixed Single
  103.       Height          =   255
  104.       Left            =   0
  105.       TabIndex        =   7
  106.       Top             =   3120
  107.       Width           =   2100
  108.    End
  109.    Begin VB.Label PaintLabel 
  110.       BorderStyle     =   1  'Fixed Single
  111.       Height          =   255
  112.       Left            =   0
  113.       TabIndex        =   5
  114.       Top             =   4920
  115.       Width           =   2100
  116.    End
  117.    Begin VB.Label PSetLabel 
  118.       BorderStyle     =   1  'Fixed Single
  119.       Height          =   255
  120.       Left            =   0
  121.       TabIndex        =   4
  122.       Top             =   1320
  123.       Width           =   2100
  124.    End
  125.    Begin VB.Label Label1 
  126.       Alignment       =   2  'Center
  127.       Caption         =   "PaintPicture"
  128.       Height          =   255
  129.       Index           =   1
  130.       Left            =   0
  131.       TabIndex        =   3
  132.       Top             =   3600
  133.       Width           =   2100
  134.    End
  135.    Begin VB.Label Label1 
  136.       Alignment       =   2  'Center
  137.       Caption         =   "Point/PSet"
  138.       Height          =   255
  139.       Index           =   0
  140.       Left            =   0
  141.       TabIndex        =   2
  142.       Top             =   0
  143.       Width           =   2100
  144.    End
  145.    Begin VB.Menu mnuFile 
  146.       Caption         =   "&File"
  147.       Begin VB.Menu mnuFileExit 
  148.          Caption         =   "E&xit"
  149.       End
  150.    End
  151. End
  152. Attribute VB_Name = "MirrorForm"
  153. Attribute VB_Creatable = False
  154. Attribute VB_Exposed = False
  155. Option Explicit
  156.  
  157. ' ***********************************************
  158. ' Mirror the left halves of PSetSource and
  159. ' PaintSource onto their right halves.
  160. ' ***********************************************
  161. Private Sub Form_Load()
  162. Dim x As Single
  163. Dim y As Single
  164. Dim wid As Single
  165. Dim hgt As Single
  166. Dim start_time As Single
  167. Dim stop_time As Single
  168.  
  169.     Me.Show
  170.     MousePointer = vbHourglass
  171.     Refresh
  172.     
  173.     ' Mirror using PSet/Paint.
  174.     start_time = Timer
  175.     wid = PSetSource.ScaleWidth
  176.     For x = 0 To wid
  177.         For y = 0 To PSetSource.ScaleHeight
  178.             PSetDest.PSet (wid - x, y), PSetSource.Point(x, y)
  179.         Next y
  180.     Next x
  181.     stop_time = Timer
  182.     PSetLabel.Caption = Format$(stop_time - start_time, "0.000") & " sec"
  183.     Refresh
  184.     
  185.     ' Mirror using PSet/Paint with refresh.
  186.     start_time = Timer
  187.     wid = RefreshSource.ScaleWidth
  188.     For x = 0 To wid
  189.         For y = 0 To RefreshSource.ScaleHeight
  190.             RefreshDest.PSet (wid - x, y), RefreshSource.Point(x, y)
  191.         Next y
  192.         RefreshDest.Refresh
  193.     Next x
  194.     stop_time = Timer
  195.     RefreshLabel.Caption = Format$(stop_time - start_time, "0.000") & " sec"
  196.     Refresh
  197.  
  198.     ' Mirror using PaintPicture.
  199.     start_time = Timer
  200.     wid = PaintSource.ScaleWidth
  201.     hgt = PaintSource.ScaleHeight
  202.     PaintDest.PaintPicture PaintSource.Picture, _
  203.         0, 0, wid, hgt, _
  204.         wid - 1, 0, -wid, hgt, vbSrcCopy
  205.     stop_time = Timer
  206.     PaintLabel.Caption = Format$(stop_time - start_time, "0.000") & " sec"
  207.  
  208.     MousePointer = vbDefault
  209. End Sub
  210.  
  211. Private Sub Form_Unload(Cancel As Integer)
  212.     End
  213. End Sub
  214.  
  215.  
  216. Private Sub mnuFileExit_Click()
  217.     Unload Me
  218. End Sub
  219.  
  220.  
  221.